package com.retail.member.controller;

import com.retail.core.entity.result.Result;
import com.retail.member.client.AdminVerifyClient;
import com.retail.member.entity.request.VerifyOrderRequest;
import com.retail.order.entity.request.SysAdminVerifyRequest;
import com.retail.order.entity.vo.SysAdminVerifyDetailVo;
import com.retail.order.entity.vo.SysAdminVerifyVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(value = "用户核销页面API", tags = "用户核销页面API")
@RestController
@RequestMapping("api/verify")
public class AdminVerifyApiController {

    private final AdminVerifyClient adminVerifyClient;

    public AdminVerifyApiController(AdminVerifyClient orderClient) {
        this.adminVerifyClient = orderClient;
    }

    @ApiOperation("用户待核销订单列表")
    @GetMapping("toBeVerifyOrders/{adminId}")
    public Result<List<SysAdminVerifyDetailVo>> toBeVerifyOrders(@PathVariable("adminId") String adminId) {
        return adminVerifyClient.toBeVerifyOrders(adminId);
    }

    @ApiOperation("用户核销订单")
    @PostMapping("verifyOrder")
    public Result<Integer> verifyOrder(@RequestBody VerifyOrderRequest request) {
        return adminVerifyClient.verifyOrder(request);
    }

    /**
     * 核心结果
     *
     * @param hxId
     * @return
     */
    @GetMapping("verifyDetail/{hxId}")
    public Result<SysAdminVerifyVo> verifyDetail(@PathVariable("hxId") Long hxId) {
        return adminVerifyClient.verifyDetail(hxId);
    }


    @GetMapping("adminVerifyList/{adminId}")
    public Result<List<SysAdminVerifyVo>> adminVerifyList(@PathVariable("adminId") Long adminId) {
        return adminVerifyClient.adminVerifyList(adminId);
    }

    /**
     * 查询用户核销
     *
     * @param request
     * @return
     */
    @PostMapping("adminVerifyListStatus")
    public Result<List<SysAdminVerifyVo>> adminVerifyListStatus(@RequestBody SysAdminVerifyRequest request) {
        return adminVerifyClient.adminVerifyListStatus(request);
    }

    /**
     * 查看核验列表查看
     * @date: 2024/8/5 10:09
     * @param userId
     * @return com.retail.core.entity.result.Result
     */
    @GetMapping("getList/{userId}")
    public Result getList(@PathVariable("userId") Long userId) {
        return adminVerifyClient.getList(userId);
    }

    @GetMapping("getModel/{id}")
    public Result getModel(@PathVariable("id") Long id) {
        return adminVerifyClient.getModel(id);
    }
}
